summaryrefslogtreecommitdiff
path: root/ui/routes/(app)/c/[conversation]/+page.svelte
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2026-02-11 14:56:58 -0500
committerKit La Touche <kit@transneptune.net>2026-02-11 14:56:58 -0500
commiteae9c15a7cd76d886337b8034d9802ac9d9d7c2d (patch)
treeee5cee40b98dfbabc8b2e32cb1a4781ee28d1fcc /ui/routes/(app)/c/[conversation]/+page.svelte
parent4336d175ab7199368084f846806f319a696ad145 (diff)
Clean up service worker logic
There's an asymmetry between client/sw message passing, and push event messages. I found that out experimentally. I was also mistakenly assigning to the wrong attribute of the unread-status object. Tentatively good now, but I need real new-message-events from the server to be sure.
Diffstat (limited to 'ui/routes/(app)/c/[conversation]/+page.svelte')
-rw-r--r--ui/routes/(app)/c/[conversation]/+page.svelte8
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/routes/(app)/c/[conversation]/+page.svelte b/ui/routes/(app)/c/[conversation]/+page.svelte
index 24baa47..5a832ee 100644
--- a/ui/routes/(app)/c/[conversation]/+page.svelte
+++ b/ui/routes/(app)/c/[conversation]/+page.svelte
@@ -56,6 +56,14 @@
if (!!at) {
session.local.updateLastReadAt(conversationId, at);
}
+
+ navigator.serviceWorker.ready.then((registration) => {
+ registration.active.postMessage({
+ type: 'CONVERSATION_READ',
+ conversationId,
+ at,
+ });
+ });
}
$effect(() => {